x86-64: fix incorrect assertion in __maddr_to_virt()
authorJan Beulich <jbeulich@novell.com>
Wed, 15 Jun 2011 19:24:09 +0000 (20:24 +0100)
committerJan Beulich <jbeulich@novell.com>
Wed, 15 Jun 2011 19:24:09 +0000 (20:24 +0100)
When memory map sparseness reduction is in use, machine address ranges
can't validly be compared directly against the total size of the
direct mapping range.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/include/asm-x86/x86_64/page.h

index d146e992e8cf043be3740dc7330995f7e9a46cc9..fc006f44566451ceed137eb01b5a7ff784ebf9e5 100644 (file)
@@ -96,7 +96,7 @@ static inline unsigned long __virt_to_maddr(unsigned long va)
 
 static inline void *__maddr_to_virt(unsigned long ma)
 {
-    ASSERT(ma < DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START);
+    ASSERT(pfn_to_pdx(ma >> PAGE_SHIFT) < (DIRECTMAP_SIZE >> PAGE_SHIFT));
     return (void *)(DIRECTMAP_VIRT_START +
                     ((ma & ma_va_bottom_mask) |
                      ((ma & ma_top_mask) >> pfn_pdx_hole_shift)));